Optional deps#453
Conversation
|
Closes #448 |
There was a problem hiding this comment.
The remaining tests (lines 41–74) have the same jest.isolateModules() return-value issue and should be fixed identically by adding return before each jest.isolateModules(...) call.
Summary: The PR correctly moves cloud storage SDKs to optional peer dependencies and adds runtime MODULE_NOT_FOUND guards with actionable error messages — the overall approach is sound. However, all seven tests in optionalDeps.test.js discard the return value of jest.isolateModules(), which means assertion failures inside those callbacks may not always be reliably propagated to Jest, making the test suite fragile. Each test should return jest.isolateModules(...) to ensure proper error propagation.
PR Bot Information
Version: 1.20.51
- Correlation ID:
ca32d7d4-42b1-4341-9c88-0392b574989f - Event Trigger:
pull_request.opened - File Content Strategy: Full file content
- LLM:
anthropic--claude-4.6-sonnet
… Azure, and GCP storage providers
…into optional-deps
|
Is there a reason why we still use axios? We should probably move away from it and use Node's native |
Make Cloud Storage SDKs Optional Peer Dependencies (Breaking Change v4.0.0)
New Feature / Refactor
♻️ Cloud storage SDKs (
@aws-sdk/client-s3,@aws-sdk/lib-storage,@azure/storage-blob,@google-cloud/storage) are now optional peer dependencies. Users only need to install the SDK(s) for the cloud provider they actually use. If a required SDK is missing at runtime, a clear, actionable error message is shown with the exactnpm installcommand to fix it.Changes
package.json: Moved cloud storage SDKs fromdevDependenciestopeerDependenciesand addedpeerDependenciesMetamarking all four SDKs asoptional: true. Also addedaxiosas a direct dependency.srv/attachments/aws-s3.js: Wrappedrequirecalls for@aws-sdk/client-s3and@aws-sdk/lib-storagein atry/catchblock to throw a helpful error if either SDK is missing.srv/attachments/azure-blob-storage.js: Wrappedrequirefor@azure/storage-blobin atry/catchto provide a clear install instruction onMODULE_NOT_FOUND.srv/attachments/gcp.js: Wrappedrequirefor@google-cloud/storagein atry/catchwith an informative error message if the SDK is absent.lib/mtx/server.js: Applied the same lazy-require pattern with helpful error messages for the cleanup functions targeting AWS S3, Azure Blob, and Google Cloud Storage.tests/unit/optionalDeps.test.js: Added new unit tests verifying that each storage provider module throws a helpful error with the correct install command when its SDK is missing, and loads successfully when the SDK is present.CHANGELOG.md: Documented this as a breaking change in the upcomingv4.0.0release.PR Bot Information
Version:
1.20.51ca32d7d4-42b1-4341-9c88-0392b574989fanthropic--claude-4.6-sonnetpull_request.opened